<template>
	<view class="phxx-item-detail">
		<view class="content-box" >
			<view class="top block-back">
				<view class="cph-box">
					<view class="cph">
						{{ itemList.carBrand || '-' }}
					</view>
				</view>
				<view :class="{'gray-type': itemList.status == 8,'orange-type': (itemList.status == 0) || (itemList.status == 1),'blue-type': (itemList.status == 2) || (itemList.status == 3) || (itemList.status == 4) || (itemList.status == 5) || (itemList.status == 6),
									 'green-type': itemList.status == 7,'red-type': (itemList.status == 9) || (itemList.status == 10),'status': true}">
									 {{ itemList.statusName }}
				</view>
			</view>
			
			<view class="bottom block-back">
				<view class="title-box">采购信息</view>
				<view class="line"></view>
        <view class="items">
          <text class="til col99">中转客户:</text>
          <text class="val col33">{{ itemList.purchase || '-'}}</text>
        </view>
        <view class="items">
          <text class="til col99">供应商:</text>
          <text class="val col33">{{ itemList.supplierName || '-'}}</text>
        </view>
				<view class="items">
					<text class="til col99">承运单位:</text>
					<text class="val col33">{{ itemList.cusTransport || '-'}}</text>
				</view>
				<view class="items">
					<text class="til col99">煤种:</text>
					<text class="val col33">{{ itemList.proName || '-'}}</text>
				</view>
				<view class="items">
					<text class="til col99">装货地:</text>
					<text class="val col33">{{ itemList.loadingSiteName || '-'}}</text>
				</view>
				<view class="items">
					<text class="til col99">卸货地:</text>
					<text class="val col33">{{ itemList.unloadingPlace || '-'}}</text>
				</view>
				<view class="items">
					<text class="til col99">卸货点:</text>
					<text class="val col33">{{ itemList.landingPointName || '-'}}</text>
				</view>
			</view>
			
			
			<view class="bottom block-back">
				<view class="bottom title-box">运输情况</view>
				<view class="line mgrb20"></view>
				<view class="bottom title-box1"><view class="til-icon-name"></view>矿发信息</view>
				<view class="bottom block-items">
					<view class="items gray-back">
						<view class="til col99 font13">毛重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.mineralGrossWeight || '-'}}</view>
					</view>
					<view class="items gray-back">
						<view class="til col99 font13">皮重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.mineralTareWeight || '-'}}</view>
					</view>
					<view class="items gray-back">
						<view class="til col99 font13">净重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.mineralNetWeight || '-'}}</view>
					</view>
				</view>
				<view class="items">
					<text class="til col99">矿发时间:</text>
					<text class="val col33">{{ itemList.mineralTime || '-'}}</text>
				</view>
				<view class="items mgrb20">
				    <text class="til col99">矿发磅单:</text>
					<image class="val col33" v-if="!!itemList.mineralPoundList" @click="clickImg(itemList.mineralPoundList)" :src="itemList.mineralPoundList" style="width: calc(100% - 200rpx);"></image>
<!--					<image class="val col33" v-else :src="imagesPath" style="width: 157px;"></image>-->
				</view>
        <view class="items mgrb20" style="width: 100%">
          <text class="til col99">铅封照片:</text>
          <view v-for="(imageSrc, index) in itemList.sealPhotographs" :key="index">
            <image
                class="val col33"
                @click="clickImg(imageSrc)"
                :src="imageSrc || ''"
                style="width: 80px;padding: 6px"
            ></image>
          </view>
        </view>
				<view class="bottom title-box1"><view class="til-icon-name"></view>到站信息</view>
				<view class="bottom block-items">
					<view class="items gray-back">
						<view class="til col99 font13">毛重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.grossWeight || '-'}}</view>
					</view>
					<view class="items gray-back">
						<view class="til col99 font13">皮重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.tareWeight || '-'}}</view>
					</view>
					<view class="items gray-back">
						<view class="til col99 font13">净重(吨)</view>
						<view class="val col00 font16 fontwtb">{{ itemList.netWeight || '-'}}</view>
					</view>
				</view>
				<view class="items">
					<text class="til col99">到站录皮时间:</text>
					<text class="val col33">{{ itemList.tareTime || '-'}}</text>
				</view>
				<view class="items">
				    <text class="til col99">站台磅单:</text>
				    <image class="val col33" v-if="!!itemList.platformScale" @click="clickImg(itemList.platformScale)" :src="itemList.platformScale" style="width: calc(100% - 200rpx);"></image>
<!--					<image class="val col33" v-else :src="imagesPath" style="width: 157px;"></image>-->
				</view>
				<view class="bottom block-items" style="padding: 20rpx!important;">
					<view class="items blue-back">
						<text class="til col99 font13">亏吨:</text>
						<text class="val col00 font16 fontwtb">{{ itemList.deficientTon || '-'}}</text>
					</view>
					<view class="items blue-back">
						<text class="til col99 font13">涨吨:</text>
						<text class="val col00 font16 fontwtb">{{ itemList.riseTon || '-'}}</text>
					</view>
					<view class="items blue-back">
						<text class="til col99 font13">扣费:</text>
						<text class="val col00 font16 fontwtb">{{ itemList.deductCost || '-'}}</text>
					</view>
				</view>
			</view>
			
			
			<view class="bottom-btn" v-if="1==2">
				<view>
					<button class="cancelBtn" size="mini" @click="examine()">审核</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import {getWayBillDetails} from '@/api/transport.js';
import {getDictDatas} from '@/api/me.js';
import {dictTansParams} from '@/utils/common.js';
import config from '@/config'
export default {
	name: 'row-number',
	data() {
		return {
			wayBillStatusData:[],
			imagesPath: config.baseImgUrl + '/img.png',
			itemList: {
				status: '',
				statusName: '',
				carBrand: '',
				purchase: '',
				cusTransport: '',
				proName: '',
				loadingSiteName: '',
				unloadingPlace: '',
				unloadingPoint: '',
				landingPointName:'',
				mineralGrossWeight: '',
				mineralTareWeight: '',
				mineralNetWeight: '',
				mineralTime: '',
				grossWeight: '',
				tareWeight: '',
				netWeight: '',
				tareTime: '',
				platformScale: '',
				mineralPoundList: '',
        deficientTon:'',
        riseTon:'',
				deductCost:'',
        sealPhotographs: [],
        supplierName: ''
			}
		}
	},
	onLoad(options) {
		this.fromMap = false
		if(!!options){
			if(!!options.id) this.getDetail(options.id)
		}
	},
	onShow() {
		//获取字典
		this.getLicenseTypeDict()
	},
	methods: {
    clickImg(url) {
      uni.previewImage({
        urls: [url]
      });
    },
		async getLicenseTypeDict() {
		  let datas = await getDictDatas()
		  this.wayBillStatusData = dictTansParams(datas.data, 'purchase_waybill_status')
		  for (var i = 0; i < this.wayBillStatusData.length; i++) {
			  if(this.itemList.status == this.wayBillStatusData[i].value){
				  this.itemList.statusName = this.wayBillStatusData[i].text
			  }
		  }
		},
		async getDetail(id){
			let data = await getWayBillDetails(id)
			let _ = this
			if(data.code == 200){
				_.itemList.id = data.data.id
				_.itemList.carBrand = data.data.carBrand
				_.itemList.status = data.data.status
				_.itemList.purchase = data.data.purchase
				_.itemList.cusTransport = data.data.cusTransport
				_.itemList.proName = data.data.proName
				_.itemList.loadingSiteName = data.data.loadingSiteName
				_.itemList.unloadingPlace = data.data.unloadingPlace
				_.itemList.unloadingPoint = data.data.unloadingPoint
				_.itemList.landingPointName = data.data.landingPointName
				_.itemList.mineralGrossWeight = data.data.mineralGrossWeight
				_.itemList.mineralTareWeight = data.data.mineralTareWeight
				_.itemList.mineralNetWeight = data.data.mineralNetWeight
				_.itemList.mineralTime = data.data.mineralTime
				_.itemList.mineralPoundList = data.data.mineralPoundList
				_.itemList.grossWeight = data.data.grossWeight
				_.itemList.tareWeight = data.data.tareWeight
				_.itemList.netWeight = data.data.netWeight
				_.itemList.tareTime = data.data.tareTime
				_.itemList.platformScale = data.data.platformScale
        _.itemList.deficientTon = data.data.deficientTon
        _.itemList.riseTon = data.data.riseTon;
				_.itemList.deductCost = data.data.deductPrice;
        _.itemList.sealPhotographs = data.data.sealPhotographs;
        _.itemList.supplierName = data.data.supplierName;
			}
		},
		examine(){
			
		},
		queueRule(){
			
		},
		handleClick(item, type) {
			console.log(item);
			this.$emit('manualCalling', item, type);
		}
	}
};
</script>

<style lang="scss" scoped>
.cph-box {
	min-width: 160rpx;
	background: #FFE24A;
	overflow: hidden;
	height: 88rpx;
	border-radius: 5rpx;
	.cph {
		font-weight: bold;
		font-size: 32rpx;
		min-width: 160rpx;
		border: 1px solid #333;
		padding: 0 14rpx;
		margin: 4rpx;
		border-radius: 5rpx;
		height: 80rpx;
		line-height: 80rpx;
	}
}
</style>
